package com.ky.gp.app.controller;



import com.ky.common.param.UserAdd;
import com.ky.common.param.UserLogin;


import com.ky.common.vo.R;
import com.ky.gp.app.service.UserFeign;


import com.ky.user.entity.User;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import javax.servlet.http.HttpServletRequest;



@RestController
@RequestMapping("/api/user")
public class UserController {
    @Autowired
    private UserFeign userFeign;
    @RequestMapping("/findAllFollows")
    public R findAllFollows(){
        return userFeign.findAllFollows();
    }

    @RequestMapping("/loginpass")
    public R loginPass(@RequestBody UserLogin userLogin) {
        return userFeign.loginPass(userLogin);
    }

    /**
     * 使用手机号验证码登录
     *
     * @param userLogin
     * @return
     */
    @RequestMapping("/logincode")
    public R loginCode(@RequestBody UserLogin userLogin) {
        return userFeign.loginCode(userLogin);
    }
    @RequestMapping("/getUser")
    public R getUser(){
        return userFeign.getUser();
    }
    @ApiOperation(value = "用户注册接口")
    @RequestMapping(value = "/register")
    public R register(@RequestBody UserAdd userAdd){
        return userFeign.register(userAdd);
    }
    @RequestMapping("/findByMapFollows")
    public R findByMapFollows(@RequestParam("username") String username){
        return userFeign.findByMapFollows(username);
    }
    @RequestMapping("/logout")
    public R logout(){
        return userFeign.logout();
    }
    @RequestMapping("/findById")
    public R findById(){
        return userFeign.findById();
    }
    @PostMapping("/save")
    public R save(@RequestBody User user) {
        return userFeign.saveUser(user);
    }
    @PostMapping("/updatePassword")
    public R updatePassword(@RequestBody User user) {
        return userFeign.updatePassword(user);
    }

    @PostMapping("/updatePhone")
    public R updatePhone(@RequestBody User user) {
        return userFeign.updatePhone(user);
    }

   /* @RequestMapping("/selectUser")
    public R selectUser(@RequestParam("userId") int userId) {*/
    @RequestMapping("/user/selectUser/{userId}")
    public R selectUser(@PathVariable("userId") int userId){
        return userFeign.selectUser(userId);
    }
}
